//
// Created by Administrator on 2025/3/12.
//

#ifndef LVGL_UI_WORD_QUERY_COMPOMENT_H
#define LVGL_UI_WORD_QUERY_COMPOMENT_H
#include "../ui_screen_common/cc_screen_common.h"
#include "word_query_data_dao.h"
#define UI_COMP_WORD_QUERY_SCREEN_NUM 10
#define INPUT_BOX_MAX_LEN 30  // 输入框最大长度
#define WORD_QUERY_RECENTLY_WORD_LIST_PAD_ROW 6
#define WORD_QUERY_SEARCH_WORD_LIST_PAD_ROW 12

//#include <stdio.h>
//#include <stdlib.h>
//#include "ui_word_quey_main_screen.h"
typedef void (*ui_word_query_screen_deinit)();

// 单词查询界面结构体
typedef struct {
    lv_obj_t *screen;
    lv_group_t *group;
    ui_word_query_screen_deinit deinit_cb; // 退出当前界面回调函数
} ui_word_query_main_screen_t;





// 单词查询模块结构体
typedef struct {
    ui_word_query_main_screen_t *screen;
    ui_word_query_data_t *data;
}word_query_module_t;



// 单词查询对象类型
enum {
    UI_WORD_QUERY_OBJ_TYPE_NONE = 0,
    UI_WORD_QUERY_OBJ_TYPE_LETTER_PARENT,
    UI_WORD_QUERY_OBJ_TYPE_LETTER_CHILD,
    UI_WORD_QUERY_OBJ_TYPE_WORD_LIST_CHILD,
    UI_WORD_QUERY_OBJ_TYPE_INPUT_BOX_PANEL,
    UI_WORD_QUERY_OBJ_TYPE_DELETE_PANEL,
    UI_WORD_QUERY_OBJ_TYPE_TOP_PANEL_LABEL,
};

// 单词查询事件数据
typedef struct {
    int index;
    int obj_type;
    int letter_size;
    lv_obj_t *prev_obj;
    lv_obj_t *next_obj;
    lv_obj_t *prev_parent_obj;
    lv_obj_t *next_parent_obj;
    lv_obj_t *extra_obj;
    int prev_child_size;
    int next_child_size;
}word_query_event_data_t;

extern ui_word_query_data_t ui_word_query_data;
extern ui_word_query_main_screen_t ui_word_query_main_screen;
extern word_query_module_t word_query_module;

#endif //LVGL_UI_WORD_QUERY_COMPOMENT_H
